// #ifdef  H5
import './css/reset.css';
// #endif
import './static/css/weui.css'
import './css/public.less'
import Vue from 'vue'
import App from './App'
import store from './store'
import dialog from '@/utils/dialog'
import cookie from '@/utils/cookie'

Vue.config.productionTip = false
Vue.prototype.$store = store

App.mpType = 'app'

const app = new Vue({
	store,
	...App
})
app.$mount()

// 全局数据
Vue.prototype.globalData = {
  store:{}
}
// 弹窗
Vue.prototype.dialog = dialog

Vue.prototype.cookie = cookie

// 返回上一级
Vue.prototype.navigateBack = function (delta = 1) {
  const arr = getCurrentPages() // eslint-disable-line
  if (arr.length >= 2) {
    uni.navigateBack({ delta })
  } else {
    uni.reLaunch({ url: '/pages/order/main' })
  }
}
Vue.prototype.checkLogin = function (type = 'reLaunch') {
  if (!cookie.isLogin()) {
    uni.isRedirect = true // 已重定向
    uni[type]({ url: '/pages/login/main' })
  }else{
    return true;
  }
}
